home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / modeler / wedge.lwm < prev    next >
Text File  |  1993-12-13  |  2KB  |  104 lines

  1. /* CMD: Wedge
  2.  * Make Wedge/Ring in Modeler  */
  3. /* By Arnie Cachelin Copyright © 1992 NewTek, Inc. */
  4.  
  5. arg angle startangle name
  6. if angle="" then angle=360
  7. if startangle="" then startangle=0
  8. Ax='Y'
  9. libadd = addlib("LWModelerARexx.port",0)
  10. signal on error
  11. signal on syntax
  12.  
  13. if name="" then name="Wedge"
  14. else name=strip(name)
  15.  
  16. call req_begin "Wedge"
  17.  
  18. AxId = req_addcontrol("Axis", "CH",'X Y Z')
  19. SegId = req_addcontrol("Degrees per Section",'N',0)
  20. TopId = req_addcontrol("Top",'N',0)
  21. BotId = req_addcontrol("Bottom",'N',0)
  22. InRadId = req_addcontrol("Inner Radius",'N',0)
  23. OutRadId = req_addcontrol("Outer Radius",'N',0)
  24. StAngId = req_addcontrol("Start Angle",'N',0)
  25. AngId = req_addcontrol("End Angle",'N',0)
  26. SurfId = req_addcontrol("Surface",'R')
  27.  
  28. call req_setval SegId, 10,22.5
  29. call req_setval AxId, 2
  30. call req_setval TopId, 1,1
  31. call req_setval BotId, 0,0
  32. call req_setval InRadId, .5,0
  33. call req_setval OutRadId, 1,1
  34. call req_setval StAngId, startangle
  35. call req_setval AngId, angle
  36.  
  37. x = req_post()
  38. if (x) then do
  39.     degs= req_getval(SegId)
  40.     Ax= req_getval(AxId)
  41.     name= req_getval(SurfId)
  42.     startangle= req_getval(StAngId)
  43.     angle= req_getval(AngId)
  44.     top= req_getval(TopId)
  45.     bot= req_getval(BotId)
  46.     r1= req_getval(InRadId)
  47.     r2= req_getval(OutRadId)
  48.     call req_end()
  49.     end
  50. else do
  51.  call req_end()
  52.  exit
  53.  end
  54.  
  55. segs=abs(angle-startangle)%degs
  56.  
  57. if Ax=1 then do
  58.   Ax='X'
  59.   lax='Z'
  60.   lc=top' 'r1' 0'
  61.   hc=bot' 'r2' 0'
  62.   end
  63. else if Ax=2 then do
  64.   Ax='Y'
  65.   lax='Z'
  66.   lc=r1' 'top' 0'
  67.   hc=r2' 'bot' 0'
  68.   end
  69. else if Ax=3 then do
  70.   Ax='Z'
  71.   lax='Y'
  72.   lc=r1' 0 'top
  73.   hc=r2' 0 'bot
  74.   end
  75.  
  76.  /* Need to clear out objects, or they will be lathed too!  :(  */
  77. call CUT()
  78. call SURFACE(name)
  79. call MAKEBOX(lc,hc)
  80. call LATHE(Ax,segs,0,angle,startangle)
  81. call PASTE()      /* Replace stuff we cleared out :) */
  82. exit
  83.  
  84. syntax:
  85. error:
  86.   call end_all
  87.     t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
  88.   if (libadd) then call remlib("LWModelerARexx.port")
  89.     exit
  90.  
  91.  
  92. /* Didn't need this ... yet */
  93. GotoScratchLayer: PROCEDURE
  94.   curlay=curlayer()
  95.   empty = emptylayers()
  96.   scr = word(empty, 1)
  97.   if (scr = curlay) then
  98.     if word(empty, 2)~="" then scr=word(empty,2)
  99.   if (scr == "") then do
  100.     call notify 1,"!Need an empty layer for scratch work."
  101.     exit 10
  102.   end
  103.   call setlayer(scr)
  104.   return(curlay)